import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state:{
        Hero:null,
        imgUrl:null
    },
    actions:{
        changeHero(a,name){
            a.commit('changeHero',name)
        },
        changeImgUrl(a,name){
            a.commit('changeImgUrl',name)
        },
    },
    mutations:{
        changeHero(state,name){
            state.Hero = name;
            console.log('式神',state.Hero)
        },
        changeImgUrl(state,name){
            state.imgUrl = name;
            console.log('图片',state.imgUrl)
        }
    }
})

export default store